﻿Imports System
Imports System.Collections
Imports System.Configuration
Imports System.Data
Imports System.Linq
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Xml.Linq
Imports System.Collections.Generic

Imports DotNetNuke
Imports DotNetNuke.Security
Imports Hospital
Imports DotNetNuke.Entities.Modules

Namespace DotNetNuke.Modules.Hospital
    Partial Class ManageHospital
        Inherits PortalModuleBase

        ''' <summary>
        ''' Page load
        ''' </summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        ''' <remarks></remarks>
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            LoadDataForRepeater()
        End Sub

        'Get data and binding into repeater
        Private Sub LoadDataForRepeater()
            Dim context As HospitalDataContext = New HospitalDataContext()
            Dim lstHospital = (From p In context.cwc_Hospitals _
                         Select New HospitalDTO With {.HospitalId = p.hospitalID, .HospitalName = p.hospitalName}).ToList()
            rptListHospital.DataSource = lstHospital
            rptListHospital.DataBind()

        End Sub
        Protected Sub rptListHospital_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rptListHospital.ItemCommand
            Me.Response.Redirect("Default.aspx?TabId=" + Me.TabId.ToString + "&hid=" & e.CommandArgument.ToString() + "&go=EditHospital")
        End Sub

        Protected Sub btnAddNew_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAddNew.Click
            Me.Response.Redirect("Default.aspx?TabId=" + Me.TabId.ToString + "&go=EditHospital")
        End Sub
    End Class
    Public Class HospitalDTO
        Private _certificationId As Integer
        Public Property HospitalId() As Integer
            Get
                Return _certificationId
            End Get
            Set(ByVal value As Integer)
                _certificationId = value
            End Set
        End Property
        Private _certificationName As String
        Public Property HospitalName() As String
            Get
                Return _certificationName
            End Get
            Set(ByVal value As String)
                _certificationName = value
            End Set
        End Property
    End Class

End Namespace
